package com.onpositive.mediawiki.redirects;

	import java.io.BufferedReader;
	import java.io.FileInputStream;
	import java.io.InputStreamReader;
	import java.util.HashMap;

public class RefsCaseCorrector {

		protected HashMap<String, String> corrections = new HashMap<String, String>();

		public RefsCaseCorrector(String path) throws Exception{
			BufferedReader d=new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"));
			while (true){
				String title = d.readLine();
				if (title==null){
					break;
				}
				corrections.put(title.trim().toLowerCase().replaceAll(" ", "_"), title.trim() );
			}
		}

		public String getCaseCorrection(String title) {
			return corrections.get(title.trim().toLowerCase().replaceAll(" ", "_").trim() );
		}
	}

